#************* Euclidean distance ************
mydata <- as.data.frame(inspect(myTdm));
hc <- hclust(dist(mydata), method="average");
plot(hc);
#cut tree to get 6 clusters
rect.hclust(hc, k = 6);

#************ DTW distance ****************
distMatrix <- dist(mydata, method ="DTW"); # very slow....
hc <- hclust(distMatrix, method="average");
plot(hc);
rect.hclust(hc, k = 6);